﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;

namespace FSM.Web.Models
{
    public class AuthencationHelper
    {
        /// <summary>
        /// 获得用户公司编号
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static string GetLoginCompantNo(ClaimsPrincipal user)
        {
            return user.FindFirstValue(ClaimTypes.Role);
        }

        /// <summary>
        /// 获得用户编号
        /// </summary>
        /// <param name="user">登录用户信息</param>
        /// <returns></returns>
        public static string GetLoginUserNo(ClaimsPrincipal user)
        {
            return user.FindFirstValue(ClaimTypes.Sid);
        }
    }
}
